<div class="site-showcase"> 
  <!-- Start Page Header -->
  <div class="parallax page-header" style="background-image:url(http://placehold.it/1200x260&amp;text=IMAGE+PLACEHOLDER);">
    <div class="container">
     	<h1><?php echo __('My Profile'); ?></h1>
    </div>
  </div>
  <!-- End Page Header --> 
       <?php if($this->Session->read('Auth.User.approved')==0){?>
       <div class="alert alert-danger" id="flashMessage"><h2 style="color:#b94a48;">
	   <?php echo __('Your account has been Not approved. Please provide "Prove your identity" documents. and then wait for approval. Thanks'); ?></h2></div>  
       <?php }?>

</div>
<!-- Start Content -->
<div class="main" role="main">
  <div id="content" class="content full">
    <div class="container">
      <div class="page">
        <div class="row">
          <div class="col-md-12">
            <div class="single-agent">
              <div class="counts pull-right"> <strong><?php echo __('Member Since') ?> </strong> <span> <?php echo $this->Time->format($this->Session->read('Auth.User.created'), '%B %e, %Y %I:%M %p'); ?></span></div>
             <div class="clearfix"></div>
		       <?php if(($this->Session->read('Auth.User.user_role')=='agent') or ($this->Session->read('Auth.User.user_role')=='broker_admin')){
				   $Auth_User	=	$this->Session->read('Auth.User');

				  $expiry_date_ago	=	 $this->Time->timeAgoInWords($Auth_User['expiry_date'],   array('format' => 'F jS, Y, H:i A', 'end' => '+35 year'));
	   				
					$expiry_date = strtotime($Auth_User['expiry_date']);
					$current_date = strtotime(date('Y-m-d H:m'));
					if($current_date	>	$expiry_date){
					$style	=	'style="background:#F00;"';
					$expiry_date_text	=	
					   $this->Html->link($expiry_date_ago,array('plugin'=>false,'controller'=>'packages','action'=>'pricing'),array('escape'=>false,
			  'data-toggle'=>'tooltip', 'title'=>'Click to renew your Account','style'=>'color:white;')); 
			  		$Expiry	=	'Account is Expired';
					}
					else
					{
					$style	=	'';
					$expiry_date_text	=	$expiry_date_ago;
			  		$Expiry	=	'Account Will Expire';
					}

				   
				   ?>
               <?php  ?>
               <br/>
              <div class="counts pull-right clearfix"  <?php echo $style; ?>  > <strong><?php echo __($Expiry); ?></strong> <span> 
			  <?php  echo  $expiry_date_text; ?></span></div>
		       <?php } ?>


              <h2 class="page-title"> <?php echo ($this->Session->read('Auth.User.email')); ?> </h2>
            </div>
			<?php echo $this->Form->create('User', array('role' => 'form','type' => 'file')); ?>
					<?php echo $this->Form->input('id', array('class' => 'form-control', 'placeholder' => 'Id'));?>
              <div class="block-heading" id="details">
                <h4><span class="heading-icon"><i class="fa fa-user"></i></span><?php echo __('Profile Details'); ?> ( <?php echo ($this->Session->read('Auth.User.email')); ?> )</h4>
              </div>
              <div class="padding-as25 margin-30 lgray-bg">
                <div class="row">
                  <div class="col-md-4 col-sm-4">
                    <label for="password"><?php echo __('Agent Name'); ?></label>
                  </div>
                  <div class="col-md-4 col-sm-4">
					<?php echo $this->Form->input('first_name', array('label'=>false,'class' => 'form-control first_name', 'placeholder' => 'First Name'));?>
                  </div>
                  <div class="col-md-4 col-sm-4">
					<?php echo $this->Form->input('last_name', array('label'=>false,'class' => 'form-control last_name', 'placeholder' => 'Last Name'));?>
                  </div>
                  <div class="col-md-4 col-sm-4">
					<?php //echo $this->Form->input('email', array('label'=>false,'class' => 'form-control email1', 'placeholder' => 'Email'));?>
                  </div>
                </div>
                <div class="row">
                  <div class="col-md-4 col-sm-4">
                    <label for="password"><?php echo __('Change Password'); ?></label>
                  </div>
                  <div class="col-md-4 col-sm-4">
					<?php echo $this->Form->input('new_password', array('type'=>'password','label'=>false,'class' => 'form-control pwd1', 'placeholder' => 'New password'));?>
                  </div>
                  <div class="col-md-4 col-sm-4">
					<?php echo $this->Form->input('re_password', array('type'=>'password','label'=>false,'class' => 'form-control pwd2', 'placeholder' => 'Confirm password'));?>
                  </div>
                </div>
              </div>
              <div class="block-heading" id="additionalinfo">
                <h4><span class="heading-icon"><i class="fa fa-plus"></i></span><?php echo __('Personal Info'); ?></h4>
              </div>
              <div class="padding-as25 margin-30 lgray-bg">
                <div class="row">
                  <div class="col-md-4 col-sm-4 ">
                    <label><?php echo __('Biographical Info'); ?></label>
                  </div>
                  <div class="col-md-8 col-sm-8 submit-description">
					<?php echo $this->Form->input('description', array('label'=>false,'rows'=>"5", 'cols'=>"10",'class' => 'form-control  margin-0', 'placeholder' => 'Agent Description'));?>
                  </div>
                </div>
                <hr>
                <div class="row">
                  <div class="col-md-4 col-sm-4">
                    <label>Upload Image</label>
                    <p>Upload image that are best clicked for better appearance of your profile</p>
                  </div>
                  <div class="col-md-8 col-sm-8 submit-image">
                  <div class="image-placeholder">
					<?php 
                    if(!empty($user['User']['image'])){
                    $image	=	'/files/user/'.$user['User']['image'];
                    echo $this->Html->image($image,array('alt'=>'',"class"=>"image-placeholder"));
                    }
                    else
                    {
                        echo ' <img src="" class="image-placeholder" id="agent-image" alt="Image"/>';
                    }
                     ?>                  
                  
                   </div>
					<?php echo $this->Form->input('image', array('label'=>'image','type' => 'file')); ?>
 
                  </div>
                </div>

				<?php 
					if(($user['User']['user_role']=='agent') or ($user['User']['user_role']=='broker_admin')){				
				 ?>
                <hr>
                <div class="row">
                  <div class="col-md-4 col-sm-4">
                    <label id="Prove_your_identity">Prove your identity</label>
                    <p>Upload your visa, ID Card, driving license. </p><p> Allowd Formats (.pdf, .jpg, .jpeg, .png, gif)  </p>
                    <p><?php 
					 if(!empty($user['User']['documents']))
					 echo $this->Html->link('<span class="fa fa-download fa-5x btn-link"></span>', array('action' => 'download'), array('class'=>'pull-right','escape' => false,'title'=>'Download documents')); 
 ?></p>
                  </div>
                  <div class="col-md-8 col-sm-8 submit-image">
                  <div class="image-plafceholder">
					<?php 
                    if(!empty($user['User']['documents'])){
                    $doc	=	'/files/user_doc/'.$user['User']['documents']; 
					$file_parts = pathinfo($doc);
								if(strtolower($file_parts['extension'])=='pdf'){
								?>
								<object data="<?php echo $this->Html->url($doc); ?>" type="application/pdf" width="300" height="200">
								alt : <a href="<?php echo $this->Html->url($doc); ?>">PDF Documents</a>
								</object>
								<?php
							}
							else
							{
		
							echo $this->Html->image($doc,array('alt'=>'',"class"=>"image-placeholder"));
							}

                    }
                    else
                    {
                        echo ' <img src="" class="image-placeholder" id="agent-image" alt="documents"/>';
                    }
                     ?>                  
                  
                   </div>
					<?php echo $this->Form->input('documents', array('label'=>'Documents (.pdf, .jpg, .jpeg, .png, gif)','type' => 'file')); ?>
 
                  </div>
                </div>
                <?php } ?>
              </div>
              <div class="block-heading" id="amenities">
                <h4><span class="heading-icon"><i class="fa fa-phone"></i></span><?php echo __('Contact Details'); ?></h4>
              </div>
              <div class="padding-as25 margin-30 lgray-bg">
                <div class="row">
                  <div class="col-md-6 col-sm-6">
					<?php echo $this->Form->input('mobile_phone', array('label'=>false,'class' => 'form-control pwd2', 'placeholder' => 'Mobile Phone'));?>
                  </div>
                  <div class="col-md-6 col-sm-6">
					<?php echo $this->Form->input('work_phone', array('label'=>false,'class' => 'form-control pwd2', 'placeholder' => 'Work Phone'));?>
                  </div>
                </div>
              </div>
              <div class="block-heading" id="amenities">
                <h4><span class="heading-icon"><i class="fa fa-group"></i></span><?php echo __('Social Links'); ?></h4>
              </div>
              <div class="padding-as25 margin-30 lgray-bg">
                <div class="row">
                  <div class="col-md-3 col-sm-3">
					<?php echo $this->Form->input('facebook', array('label'=>false,'class' => 'form-control', 'placeholder' => 'www.facebook.com'));?>
                  </div>
                  <div class="col-md-3 col-sm-3">
					<?php echo $this->Form->input('twitter', array('label'=>false,'class' => 'form-control', 'placeholder' => 'www.twitter.com'));?>
                  </div>
                  <div class="col-md-3 col-sm-3">
					<?php echo $this->Form->input('google_plus', array('label'=>false,'class' => 'form-control', 'placeholder' => 'www.plus.google.com'));?>
                  </div>
                  <div class="col-md-3 col-sm-3">
                  <?php echo $this->Form->input('linkedin', array('label'=>false,'class' => 'form-control', 'placeholder' => 'www.linkedin.com'));?>
                  </div>
                </div>
              </div>
              <div class="text-align-center" id="submit-property">
					<?php echo $this->Form->submit(__('Submit'), array('class' => 'btn btn-primary btn-lg')); ?>
              </div>
			<?php echo $this->Form->end() ?>
          </div>
        </div>
      </div>
    </div>
  </div>

</div>
